var a = getApp();

Page({
    data: {
        language: "",
        isMid: "",
        page: "1"
    },
    onLoad: function(a) {
        this.setData({
            isOrderid: a.id
        }), this.getshare();
    },
    onReady: function() {
        var a = wx.getStorageSync("langIndex");
        this.setData({
            language: a.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (this.data.current_page >= this.data.last_page) wx.showToast({
            title: "没有更多",
            icon: "none",
            duration: 1e3
        }); else {
            var a = this.data.page + 1;
            this.setData({
                page: a
            }), this.nextGetRecord();
        }
    },
    onShareAppMessage: function() {},
    goHome: function() {
        wx.reLaunch({
            url: "/packageG/index/index"
        });
    },
    getshare: function() {
        var e = this, t = this, o = a.getNetAddresss("coupon.share-coupon.receive");
        o += "&order_ids=" + t.data.isOrderid, a._getNetWork({
            url: o,
            success: function(a) {
                var o = a.data;
                1 == o.result ? (console.log(o), t.setData({
                    banner: o.data.set.banner,
                    status: o.data.code,
                    coupon: o.data.coupon,
                    name: o.data.member_name,
                    msg: o.data.msg
                }), e.getRecord()) : wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1e3
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getRecord: function() {
        var e = this, t = a.getNetAddresss("coupon.share-coupon.log-list");
        t += "&order_ids=" + e.data.isOrderid + "&page=" + e.data.page, a._getNetWork({
            url: t,
            success: function(a) {
                var t = a.data;
                1 == t.result ? (console.log(t), e.setData({
                    record_arr: t.data.data,
                    max_num: t.data.remainder,
                    current_page: t.data.current_page,
                    last_page: t.data.last_page
                })) : wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1e3
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    nextGetRecord: function() {
        var e = this, t = a.getNetAddresss("coupon.share-coupon.log-list");
        t += "&order_ids=" + e.data.isOrderid + "&page=" + e.data.page, a._getNetWork({
            url: t,
            success: function(a) {
                var t = a.data;
                1 == t.result ? (console.log(t), e.setData({
                    max_num: t.data.remainder,
                    record_arr: e.data.record_arr.concat(t.data.data),
                    current_page: t.data.current_page,
                    last_page: t.data.last_page
                })) : wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1e3
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});